;;; init-general.el --- key binding -*- lexical-binding:t -*-
;;; Commentary:
;;; Code:

;; general
;; (use-package general
;;   :defer t
;;   :config
;;   (general-evil-setup)

;;   (general-define-key
;;    :states '(normal visual motion)
;;    :keymaps 'override
;;    "gd" 'xref-find-definitions
;;    )

;;   (general-define-key
;;    :states '(normal visual motion)
;;    :keymaps 'override
;;    "gb" 'xref-find-references)

;;   (general-define-key
;;    :states '(normal visual motion)
;;    :keymaps 'override
;;    "C-o" 'xref-pop-marker-stack)

;;   (general-create-definer leader-key
;;     :states '(normal visual motion emacs)
;;     :prefix "SPC"
;;     :keymaps 'override
;;     )

;;   ;; command
;;   (leader-key "SPC" '(execute-extended-command :wk "M-x")) ;; 调用M-x

;;   ;; buffer
;;   (leader-key
;;     "b" '(:ignore t :wk "buffer & bookmark")
;;     "b1" '(my/kill-other-buffers :wk "kill other")
;;     "bb" '(consult-buffer :wk "list")
;;     "bd" '(evil-delete-buffer :wk "delete")
;;     "bn" '(evil-next-buffer :wk "next")
;;     "bp" '(evil-prev-buffer :wk "prev")
;;     "bc" '(evil-buffer-new :wk "create")
;;     "bm" '(consult-bookmark :wk "list bookmarks")
;;     "br" '(bookmark-delete :wk "delete bookmark")
;;     )

;;   ;; comment
;;   (leader-key
;;     "c" '(:ignore t :wk "comment")
;;     "cc" '(comment-or-uncomment :wk "comment")
;;     "cr" '(comment-or-uncomment-region :wk "comment region")
;;     )

;;   ;; docker
;;   (leader-key
;;     "d" '(:ignore t :wk "docker")
;;     "dd" '(docker :wk "docker")
;;     )

;;   ;; file
;;   (leader-key
;;     "f" '(:ignore t :wk "file")
;;     "f." '(my/open-init-file :wk "open init.el")
;;     "fa" '(align-regexp :wk "align")
;;     "ff" '(find-file :wk "find")
;;     "fo" '(consult-outline :wk "outline")
;;     "fc" '(dired-create-empty-file :wk "create")
;;     "fd" '(dired-create-directory :wk "create dir")
;;     "fs" '(save-buffer :wk "save")
;;     "fr" '(ranger :wk "ranger")
;;     "ft" '(dired :wk "dired")
;;     "fm" '(follow-mode :wk "follow")
;;     "fe" '(ediff :wk "diff")
;;     "fS" '(my/save-all-buffers :wk "save all")
;;     "fR" '(rename-file :wk "rename")
;;     "fD" '(delete-file :wk "delete")
;;     )

;;   ;; git
;;   (leader-key
;;     "g" '(:ignore t :wk "git")
;;     "gs" '(magit-status :wk "status")
;;     "gg" '(magit-dispatch :wk "dispatch")
;;     "gv" '(git-timemachine-toggle :wk "timemachine")
;;     "gr" '(consult-git-grep :wk "grep")
;;     )

;;   ;; windows
;;   (leader-key
;;     "w" '(:ignore t :wk "window")
;;     "w1" '(delete-other-windows :wk "delete other")
;;     "wu" '(winner-undo :wk "undo")
;;     "wr" '(winner-redo :wk "redo")
;;     "ws" '(evil-window-split :wk "split")
;;     "wv" '(evil-window-vsplit :wk "vsplit")
;;     "wd" '(evil-window-delete :wk "delete")
;;     "wh" '(evil-window-left :wk "left")
;;     "wj" '(evil-window-down :wk "bottom")
;;     "wk" '(evil-window-up :wk "up")
;;     "wl" '(evil-window-right :wk "right")
;;     "wo" '(other-window :wk "other")
;;     "wf" '(toggle-frame-fullscreen :wk "fullscreen")
;;     "wz" '(zoom-window-zoom :wk "zoom")
;;     "ww" '(zoom-window-next :wk "next")
;;     )

;;   ;; search
;;   (leader-key
;;     "s" '(:ignore t :wk "search")
;;     "ss" '(consult-ripgrep :wk "ripgrep")
;;     "sl" '(consult-line :wk "line")
;;     "sL" '(consult-line-multi :wk "line multi")
;;     "sf" '(consult-flycheck :wk "flycheck")
;;     "sr" '(rg-menu :wk "ripgrep")
;;     "si" '(consult-imenu :wk "imenu")
;;     "sI" '(consult-imenu-multi :wk "imenu multi")
;;     )

;;   ;; project
;;   (leader-key
;;     "p" '(:ignore t :wk "project")
;;     "pp" '(consult-dir :wk "switch")
;;     "pa" '(projectile-add-known-project :wk "add")
;;     )

;;   ;; org
;;   (leader-key
;;     "o" '(:ignore t :wk "org")
;;     "oo" '(consult-org-agenda :wk "list agenda")
;;     "oa" '(org-agenda :wk "agenda")
;;     "oc" '(org-capture :wk "capture")
;;     "ob" '(org-switchb :wk "switchb")
;;     "ow" '(org-refile :wk "refile")
;;     )

;;   ;; theme & dictionary
;;   (leader-key
;;     "t" '(:ignore t :wk "theme & dictionary")
;;     "tt" '(consult-theme :wk "theme")
;;     "tr" '(youdao-dictionary-search-at-point-posframe :wk "yodao at point")
;;     "tR" '(youdao-dictionary-search-from-input :wk "youdao input")
;;     )

;;   ;; help
;;   (leader-key
;;     "h" '(:ignore t :wk "help")
;;     "hh" '(helpful-callable :wk "callable")
;;     "ha" '(consult-apropos :wk "apropos")
;;     "hc" '(helpful-command :wk "command")
;;     "hf" '(helpful-function :wk "function")
;;     "hi" '(consult-man :wk "man")
;;     "hk" '(helpful-key :wk "key")
;;     "hm" '(helpful-macro :wk "macro")
;;     "hv" '(helpful-variable :wk "variable")
;;     "hp" '(helpful-at-point :wk "at point")
;;     )

;;   ;; view
;;   (leader-key
;;     "v" '(:ignore t :wk "view")
;;     "vw" '(webjump :wk "webjump")
;;     "vt" '(type-break :wk "type break")
;;     "vo" '(pomidor :wk "pomidor")
;;     "vl" '(consult-goto-line :wk "goto-line")
;;     )

;;   ;; emacs & package
;;   (leader-key
;;     "q" '(:ignore t :wk "emacs")
;;     "qq" '(save-buffers-kill-emacs :wk "quit")
;;     "qr" '(restart-emacs :wk "restart")
;;     "qu" '(upgrade-packages :wk "upgrade pkgs")
;;     )

;;   ;; go-mode-map
;;   (leader-key go-mode-map
;;     "m" '(:ignore :wk "golang")
;;     "ma" '(go-import-add :wk "add import")
;;     "mR" '(go-remove-unused-imports :wk "remove unused import")
;;     "md" '(dlv :wk "dlv debug")
;;     "ml" '(go-impl :wk "impl")
;;     "ma" '(go-tag-add :wk "add tag")
;;     "mr" '(go-tag-remove :wk "remove tag")
;;     "ms" '(go-fill-struct :wk "fill struct")
;;     "mf" '(gofmt :wk "gofmt")
;;     "m." '(godoc-at-point :wk "godoc")
;;     "mx" '(go-run :wk "run")
;;     "mp" '(go-playground :wk "playground")
;;     "mt" '(:ignore :wk "test")
;;     "mtt" '(go-gen-test-dwim :wk "gen")
;;     "mtf" '(go-test-current-file :wk "file")
;;     "mtt" '(go-test-current-test :wk "test")
;;     "mtp" '(go-test-current-project :wk "project")
;;     "mtb" '(go-test-current-benchmark :wk "benchmark")
;;     "mtc" '(go-test-current-coverage :wk "coverage")
;;     )

;;   ;; rustic-mode
;;   (leader-key rustic-mode-map
;;     "m" '(:ignore t :wk "rust")
;;     "mx" '(rustic-compile :wk "compile")
;;     "ma" '(rustic-cargo-add :wk "cargo add")
;;     "mr" '(rustic-cargo-rm :wk "cargo remove")
;;     "mu" '(rustic-cargo-upgrade :wk "cargo upgrade")
;;     "mf" '(rustic-cargo-fmt :wk "cargo fmt")
;;     "mo" '(rustic-cargo-outdated :wk "cargo outdated")
;;     "my" '(rustic-cargo-clippy :wk "cargo clippy")
;;     "mt" '(:ignore t :wk "test")
;;     "mtt" '(rustic-cargo-current-test :wk "test")
;;     "mtp" '(rustic-cargo-test :wk "project")
;;     "mtx" '(rustic-cargo-run :wk "run")
;;     )

;;   ;; lua-mode
;;   (leader-key lua-mode-map
;;     "m" '(:ignore t :wk "lua")
;;     "mx" '(run-lua :wk "run")
;;     )

;;   ;; c-cc-mode
;;   (leader-key c-mode-base-map
;;     "m" '(:ignore t :wk "c")
;;     "mx" '(compile :wk "compile")
;;     )
;;   )

(provide 'init-general)
;;; init-general.el ends here
